package com.yzc.mihuyou.mapper;

import com.yzc.mihuyou.entity.User;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import jdk.nashorn.internal.objects.annotations.Setter;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

/**
 * <p>
 * 用户表 Mapper 接口
 * </p>
 *
 * @author 易紫诚
 * @since 2022-04-28
 */
@Mapper
public interface UserMapper extends BaseMapper<User> {
    @Select("SELECT COUNT(*)+(SELECT SUM(invtation_prin) FROM give WHERE give_userid=1 ) AS userNum FROM pingive\n" +
            "JOIN `comment` as c \n" +
            "ON c.comment_id = pingive.pinzan\n" +
            "WHERE c.user_id = ${id}")
    public User getUserNum(long id);
}
